package com.frcdi.qms.material.mapper;

import com.frcdi.qms.material.domain.Materials;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @ClassName MaterialMapper
 * @Author Mr.Han
 * @Description //TODO $
 * @create 2024/7/8 17:35
 **/
public interface MaterialsMapper {
    @Insert("INSERT INTO material(name, remaining_quantity) VALUES (#{name}, #{remainingQuantity})")
    void insert(Materials material);

    @Update("UPDATE material SET name=#{name}, remaining_quantity=#{remainingQuantity} WHERE id=#{id}")
    void update(Materials material);

    @Delete("DELETE FROM material WHERE id=#{id}")
    void delete(Integer id);

    @Select("SELECT * FROM material WHERE id=#{id}")
    Materials selectById(Integer id);

    @Select("SELECT * FROM material")
    List<Materials> selectAll();
}
